import request from '@/config/axios'
import type { SysMenu } from './types'

export const getSysMenusListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/sys-menus', params })
}

export const createSysMenusApi = (data: Partial<SysMenu>): Promise<IResponse> => {
  return request.post({ url: '/sys-menus', data })
}

export const updateSysMenusApi = (id: string, data: Partial<SysMenu>): Promise<IResponse> => {
  return request.put({ url: `/sys-menus/id/${id}`, data })
}

export const getSysMenusDetailApi = (id: string): Promise<IResponse<SysMenu>> => {
  return request.get({ url: `/sys-menus/id/${id}` })
}

export const delSysMenusListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/sys-menus/id/${ids[0]}` })
}
